package com.miyu.system.controller.sys;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.miyu.common.pojo.cos.CosSysUser;
import com.miyu.system.service.sys.CosSysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户类
 *
 * @author MIYU
 * @date 2022/06/03
 */
@RestController
@RequestMapping("/system/user")
public class CosSysUserCtol {

    @Autowired
    private CosSysUserService cosSysUserService;

    /**
     * 编辑系统用户
     *
     * @param param 参数
     * @return {@code JSONObject}
     */
    @RequestMapping("/editSysUser")
    public JSONObject editSysUser(@RequestBody JSONObject param) {
        return cosSysUserService.editSysUser(param);
    }

    /**
     * 查询系统用户
     *
     * @param param 参数
     * @return {@code List<CosSysUser>}
     */
    @RequestMapping("/querySysUser")
    public List<CosSysUser> querySysUser(@RequestBody JSONObject param) {
        return cosSysUserService.querySysUser(param);
    }

    /**
     * 删除系统用户
     *
     * @param param 参数
     * @return {@code JSONObject}
     */
    @RequestMapping("/delCosSysUser")
    public JSONObject delCosSysUser(@RequestBody JSONArray param){
        System.out.println(param);
        JSONObject rs = new JSONObject();
        rs.put("code", "1");
        rs.put("msg", "操作成功");
        return cosSysUserService.delCosSysUser(param);
    }
}
